﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace ElingOA6_Admin_DSJCJ.BLL
{
    public partial class ItemPurchaseApplyEntry
    {
        private readonly ElingOA6_Admin_DSJCJ.DAL.ItemPurchaseApplyEntry dal = new ElingOA6_Admin_DSJCJ.DAL.ItemPurchaseApplyEntry();



        /// <summary>
        /// 获取明细数据
        /// </summary>
        /// <creator>chenly</creator>
        /// <date>2013-9-29</date>
        /// <param name="paperID">订单编号</param>
        /// <returns>List集合</returns>
        public List<Model.ItemPurchaseApplyEntry> GetListEntry(decimal itemPurchaseApplyID)
        {
            DataSet ds = dal.GetListEntry(itemPurchaseApplyID);
            List<Model.ItemPurchaseApplyEntry> entryModelList = new List<Model.ItemPurchaseApplyEntry>();
            DataTable dt = ds.Tables[0];
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Model.ItemPurchaseApplyEntry model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.ItemPurchaseApplyEntry();
                    if (dt.Rows[n]["FItemPurchaseApplyEntryID"] != null && dt.Rows[n]["FItemPurchaseApplyEntryID"].ToString() != "")
                    {
                        model.FItemPurchaseApplyEntryID = decimal.Parse(dt.Rows[n]["FItemPurchaseApplyEntryID"].ToString());
                    }
                    if (dt.Rows[n]["FItemPurchaseApplyID"] != null && dt.Rows[n]["FItemPurchaseApplyID"].ToString() != "")
                    {
                        model.FItemPurchaseApplyID = decimal.Parse(dt.Rows[n]["FItemPurchaseApplyID"].ToString());
                    }
                    if (dt.Rows[n]["FItemName"] != null)
                    {
                        model.FItemName = dt.Rows[n]["FItemName"].ToString();
                    }
                    if (dt.Rows[n]["FItemSpec"] != null)
                    {
                        model.FItemSpec = dt.Rows[n]["FItemSpec"].ToString();
                    }
                    if (dt.Rows[n]["FQty"] != null && dt.Rows[n]["FQty"].ToString() != "")
                    {
                        model.FQty = decimal.Parse(dt.Rows[n]["FQty"].ToString());
                    }
                    if (dt.Rows[n]["FPrice"] != null && dt.Rows[n]["FPrice"].ToString() != "")
                    {
                        model.FPrice = decimal.Parse(dt.Rows[n]["FPrice"].ToString());
                    }
                    if (dt.Rows[n]["FAmount"] != null && dt.Rows[n]["FAmount"].ToString() != "")
                    {
                        model.FAmount = decimal.Parse(dt.Rows[n]["FAmount"].ToString());
                    }
                    if (dt.Rows[n]["FRequestDate"] != null && dt.Rows[n]["FRequestDate"].ToString() != "")
                    {
                        model.FRequestDate = DateTime.Parse(dt.Rows[n]["FRequestDate"].ToString());
                    }
                    if (dt.Rows[n]["FNote"] != null)
                    {
                        model.FNote = dt.Rows[n]["FNote"].ToString();
                    }
                    entryModelList.Add(model);
                }
           
            }

            return entryModelList;

        }

    }
}
